#!/usr/bin/env node

const cp = require('child_process')

console.log(`I am father. PID: ${process.pid}`)

const child = cp.spawn('node', ['03-child.js'], {detached: true, stdio: [0, 1, 2]})

setTimeout( () => {
  console.log('father bye')
  process.exit()
} ,5000)


//const cp = require('child_process');

//console.log('I am father process. PID:', process.pid);

//let child = cp.spawn('./03-child.js', [], {detached: true, stdio: ['ignore', 1, 2]});

//child.unref();

//setTimeout(() => {
    //console.log('5 seconds passed. Father game over!');
      //process.exit(0);

//}, 5000);

